import java.io.IOException;

/**
 * @auther Fighter Created on 2016/11/14.
 */
public class test {

    public static void main(String[] args) throws IOException {



/*//获取classpath路径
        System.out.println("classpath路径： " + test.class.getClassLoader().getResource("").getPath());
//获取当前类的加载路径
        System.out.println("当前类加载路径： " + test.class.getResource("").getPath());*/

//        PrintWriter br=new PrintWriter(new FileWriter(test.class.getClassLoader().getResource("error.log").getFile()));
       /* BufferedWriter br=new BufferedWriter(new FileWriter(test.class.getClassLoader().getResource("error.log").getFile()));
        br.write("111");
        br.close();*/

      /*  List<HashMap<String,String>> l=new ArrayList<>();
        HashMap<String, String> hm1=new HashMap<>();
        hm1.put("PHOTOURLS","http://p3.ifengimg.com/haina/2016_47/4cfa0efbc9657ec_w550_h366.jpg");
        HashMap<String, String> hm2=new HashMap<>();
        hm2.put("PHOTOURLS","http://p3.ifengimg.com/haina/2016_47/4cfa0efbc9657ec_w550_h366.jpg");
        l.add(hm1);
        l.add(hm2);
        System.out.println(l);*/



        /*String s = "{\"TYPE\":[\"文字\",\"图片\",\"图片\"]}";
        int pos = s.lastIndexOf(",");
        System.out.println(new StringBuffer(s).replace(pos, pos + 1, "").toString());*/

//        Map<String,String>map=new HashMap<>();
//        map.put("1","1");
//        map.put("1","2");
//        System.out.println(map);

        /*String s="{\"TYPE\":[\"文字\",\"图片\",\"图片\"]}";
        System.out.println(s);
        StringBuffer sb = new StringBuffer("{\"TYPE\":[\"文字\",\"图片\",\"图片\"]}");
        int pos=s.lastIndexOf(",");

        System.out.println(sb.replace(pos,pos+1,""));*/
//        System.out.println(sb.toString());

//        String s="{\"TYPE\":[\"文字\",\"图片\",\"图片\"]}";



       /* String s="{\"TYPE\":[\"aHR0cDovL3AwLmlmZW5naW1nLmNvbS9hLzIwMTZfNDcvMzlkMTE1ODM5NTQwMWFiX3NpemU1NF93NjY1X2gzNjIuanBn\",\"aHR0cDovL3AwLmlmZW5naW1nLmNvbS9hLzIwMTZfNDcvMzlkMTE1ODM5NTQwMWFiX3NpemU1NF93NjY1X2gzNjIuanBn\"]}";
        JSONObject jsonObject = JSONObject.fromObject(s);
        String v=jsonObject.get("TYPE").toString();
//        System.out.println(v);
//        v.replaceAll()
        BASE64Decoder decoder=new BASE64Decoder();

        System.out.println(jsonObject.get("TYPE"));
        Pattern pattern= Pattern.compile("\\\"(.*?)\\\"");
        Matcher matcher=pattern.matcher(v);

        while (matcher.find()){
            String tmp=matcher.group(1);
//            System.out.println(matcher.group(1));
            matcher.group(1).replaceAll(tmp,new String(decoder.decodeBuffer(tmp)));
        }
        System.out.println(v);*/



        /*while (matcher.matches()){
            String g=matcher.group(2);
            System.out.println(g);
        }*/

        /*s = jsonObject.get("TYPE").toString();

//        String[] tmpArr = s.substring(1, s.length() - 1).replaceAll(",", "").split("\"");
        String tmpStr = s.replaceAll(",", "");
        System.out.println(tmpStr);
        tmpStr=tmpStr.substring(1,tmpStr.length()-1);
        System.out.println(Arrays.toString(tmpStr.split("\"")));*/

//        System.out.println(tmpArr.length);
//        for (String str : tmpArr) {
//            System.out.println(str);
//        }


    }
}
